//栈
export class StoreHouse {
    private arr: any[] = [];
    private lastOperation = ''
    //压栈操作  
    push(element: any) {
        this.lastOperation = 'push'
        this.arr.push(element);
    }
    //退栈操作  
    pop() {
        this.lastOperation = 'pop'
        let element = this.arr.pop()
        return element;
    }
    //获取栈顶元素  
    top() {
        return this.arr[this.arr.length - 1];
    }
    //获取栈长  
    size() {
        return this.arr.length;
    }
    //清空栈  
    clear() {
        this.arr = [];
        return true;
    }

    toString() {
        return this.arr.toString();
    }

    getLastOperation() {
        return this.lastOperation
    }
}
